package com.kang.bean.bot;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.kang.bean.enums.bot.PlayEnum;
import lombok.Data;

/**
 * @program: service
 * @description: 人口管理
 * @author: K.faWu
 * @create: 2022-06-09 13:55
 **/
@Data
public class Population {
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    private String accountCode; //账号
    private String groupCode; //群聊账号，服务器
    private Long max; //人口上限；
    private Long sum; //当前人口数量
    private Long soldierNum; //士兵数量
    private Long woodcutterNum; //伐木工数量
    private Long minerNum; //矿工数量
    private Long proNum; //农民数量

    public Population(){}
    //初始化人口管理
    public Population(String accountCode, String groupCode){
        this.accountCode = accountCode;
        this.groupCode = groupCode;
        this.max = PlayEnum.INIT_POPULATION.getMax();
        this.sum = PlayEnum.INIT_POPULATION.getNum();
        this.soldierNum = 0L;
        this.woodcutterNum = 0L;
        this.minerNum = 0L;
        this.proNum = PlayEnum.INIT_POPULATION.getNum();
    }

    public Long getId() {
        return id;
    }

    public String getAccountCode() {
        return accountCode;
    }

    public String getGroupCode() {
        return groupCode;
    }

    public Long getMax() {
        if (max == null){
            max = 0L;
        }
        return max;
    }

    public Long getSum() {
        if (sum == null){
            sum = 0L;
        }
        return sum;
    }

    public Long getSoldierNum() {
        if (soldierNum == null){
            soldierNum = 0L;
        }
        return soldierNum;
    }

    public Long getWoodcutterNum() {
        if (woodcutterNum == null){
            woodcutterNum = 0L;
        }
        return woodcutterNum;
    }

    public Long getMinerNum() {
        if (minerNum == null){
            minerNum = 0L;
        }
        return minerNum;
    }

    public Long getProNum() {
        if (proNum == null){
            proNum = 0L;
        }
        return proNum;
    }
}
